#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

class Solution {
public:
    void moveZeroes(vector<int>& nums) {
        if (nums.size() == 1) return;
        int flag = 0;
        vector<int>::iterator it = nums.begin();
        while (it!=nums.end()) {
            if (*it == 0) {
                it=nums.erase(it);
                flag++;
            }
            else it++;
        }
        for (int i = 0; i < flag; i++)
            nums.push_back(0);
        return;
    }

    void moveZeroByDoubePointer(vector<int>& nums) {
        int left = 0, right = 0;
        while (right < nums.size()) {
            if (nums[right]) {
                swap(nums[left], nums[right]);
                left++;
            }
            right++;
        }
    }
};

int main() {
    vector<int> arr = { 0,1,0,3,12 };
    Solution s;
    s.moveZeroes(arr);
}